Brian E. J. Rose, University at Albany
You really should be looking at The Climate Laboratory book by Brian Rose, where all the same content (and more!) is kept up to date.
Here you are likely to find broken links and broken code.
This document uses the interactive Jupyter notebook
format. The notes can be accessed in several different ways:
github
at https://github.com/brian-rose/ClimateModeling_coursewareAlso here is a legacy version from 2015.
Many of these notes make use of the climlab
package, available at https://github.com/brian-rose/climlab
First, some thoughts on modeling from xkcd
Let's be a little pedantic and decompose that question:
Climate is
A model is
Wikipedia: http://en.wikipedia.org/wiki/Conceptual_model
In the most general sense, a model is anything used in any way to represent anything else. Some models are physical objects, for instance, a toy model which may be assembled, and may even be made to work like the object it represents. Whereas, a conceptual model is a model made of the composition of concepts, that thus exists only in the mind. Conceptual models are used to help us know, understand, or simulate the subject matter they represent.
George E. P. Box (statistician):
Essentially, all models are wrong, but some are useful.”
From the Climate Modelling Primer, 4th ed (McGuffie and Henderson-Sellers):
In the broadest sense, models are for learning about the world (in our case, the climate) and the learning takes place in the contruction and the manipulation of the model, as anyone who has watched a child build idealised houses or spaceships with Lego, or built with it themselves, will know. Climate models are, likewise, idealised representations of a complicated and complex reality through which our understanding of the climate has significantly expanded. All models involve some ignoring, distoring and approximating, but gradually they allow us to build understanding of the system being modelled. A child's Lego construction typically contains the essential elements of the real objects, improves with attention to detail, helps them understand the real world, but is never confused with the real thing.
Why?? Think about both areas of ice and snow, and the fact that sunlight has to travel through cloudy atmosphere to get to the ice and snow. Also there is some absorption of shortwave by the atmosphere.
QUESTION: Which gases contribute to shortwave absorption?
WATER is involved in many of the terms:
A budget for the energy content of the global atmosphere-ocean system:
\begin{align} \frac{dE}{dt} &= \text{net energy flux in to system} \\ &= \text{flux in – flux out} \end{align}where $E$ is the enthalpy or heat content of the total system.
We will express the budget per unit surface area, so each term above has units W m$^{-2}$
Note: any internal exchanges of energy between different reservoirs (e.g. between ocean, land, ice, atmosphere) do not appear in this budget – because $E$ is the sum of all reservoirs.
Flux in is incoming solar radiation The solar constant is
$$ S_0 = 1365.2 \text{ W m}^{-2} $$(all values will be consistent with Trenberth and Fasullo figure unless noted otherwise)
This is the flux of energy from the sun incident on a unit area perpendicular to the beam direction.
The area-weighted global mean incoming solar flux is
$$ Q = S_0 \frac{A_{cross-section}}{A_{surface}} $$[ draw sketch of sphere and illuminated disk ]
where
So flux in is $Q = S_0 / 4 = 341.3$ W m$^{-2}$
Flux out has two parts:
Introduce terminology / notation:
OLR = outgoing longwave radiation = terrestrial emissions to space
Define the planetary albedo:
Define ASR = absorbed solar radiation \begin{align} ASR &= \text{ incoming flux – reflected flux} \\ &= Q - \alpha Q \\ &= (1-\alpha) Q \end{align}
Our energy budget then says
$$ \frac{dE}{dt} = (1-\alpha) Q - OLR $$Note: This is a generically true statement. We have just defined some terms, and made the [very good] assumption that the only significant energy sources are radiative exchanges with space.
This equation is the starting point for EVERY CLIMATE MODEL.
But so far, we don’t actually have a MODEL. We just have a statement of a budget. To use this budget to make a model, we need to relate terms in the budget to state variables of the atmosphere-ocean system.
For now, the state variable we are most interested in is temperature – because it is directly connected to the physics of each term above.
Most of what follows is intended as a "fill in the blanks" exercise. We will practice writing some Python code while discussing the physical process of longwave emission to space.
Suppose the Earth behaves like a blackbody radiator with effective global mean emission temperature $T_e$.
Then
$$ OLR = \sigma T_e^4 $$where OLR = "Outgoing Longwave Radiation", and $\sigma = 5.67 \times 10{-8}$ W m$^{-2}$ K$^{-4}$ the Stefan-Boltzmann constant
We can just take this as a definition of the emission temperature.
Looking back at the observations, the global, annual mean value for OLR is 238.5 W m$^{-2}$.
Rerranging the Stefan-Boltzmann law we get
$$ T_e = \left(\frac{\text{OLR}}{\sigma} \right)^{\frac{1}{4}} $$First just use Python like a hand calculator to calculate $T_e$ iteractively:
In [ ]:
Try typing a few different ways, with and without whitespace.
In [ ]:
But typing numbers interactively is tedious and error prone. Let's define a variable called sigma
In [ ]:
The emission to space is lower because of the greenhouse effect, which we will study in detail later.
For now, just introduce a basic concept:
Only a fraction of the surface emission makes it out to space.
We will model the OLR as
$$ \text{OLR} = \tau \sigma T_s^4 $$where $\tau$ is a number we will call the transmissivity of the atmosphere.
Let's fit this model to observations:
$$ \tau = \frac{\text{OLR}}{\sigma T_s^4} $$
In [1]:
#tau = 238.5 / sigma / 288**4
Try calculating OLR for a warmer Earth at 292 K:
In [ ]:
Naturally the emission to space is higher. By how much has it increased for this 4 degree warming?
In [ ]:
Answer: 13.5 W m$^{-2}$. Okay but this is tedious and prone to error. What we really want to do is define a reusable function
In [ ]:
Note a few things:
Once a function is defined, we can call it interactively:
In [2]:
# print(OLR(288), OLR(292), OLR(292)-OLR(288))
Note also that we defined variables named sigma and epsilon inside our OLR function.
What happens if you try to print(epsilon)
?
In [ ]:
In [ ]:
Note that we didn’t really need to define those variables inside the function. We could have written the function in one line.
But sometimes using named variables makes our code much easier to read and understand!
In [3]:
#import numpy as np
#T = np.linspace(230, 300, 10)
#print T
linspace
function creates an array of numbers evenly spaced between the start and end points. We will use the numpy
package all the time. It is the basic workhorse of scientific computing with Python. We can't do much with arrays of numbers.
Does our OLR
function work on an array of temperature values?
In [ ]:
Now let’s assign these values to a new variable.
In [4]:
#OLR = OLR(T)
Now try again to compute OLR(288)
What do you get?
In [ ]:
Now let’s re-enter our function. Start typing def
and then hit the “up arrow” key. What happens?
In [ ]:
The editor gives us lots of useful keyboard shortcuts.
Here it’s looking up the last expression we entered that began with def
. Saves a lot of time and typing!
Re-enter the function.
In [ ]:
What happens if you use the up arrow
without typing anything first?
In [ ]:
Also, try typing history
In [ ]:
This is very handy. The Python console is taking notes for you!
In [ ]:
In [5]:
%load_ext version_information
%version_information
Out[5]:
The author of this notebook is Brian E. J. Rose, University at Albany.
It was developed in support of ATM 623: Climate Modeling, a graduate-level course in the Department of Atmospheric and Envionmental Sciences
Development of these notes and the climlab software is partially supported by the National Science Foundation under award AGS-1455071 to Brian Rose. Any opinions, findings, conclusions or recommendations expressed here are mine and do not necessarily reflect the views of the National Science Foundation.
In [ ]: